package tool;

/**
 * @Author zzz
 * @Date 2022/1/8 9:51
 * @Version 1.0
 */
public class generateNNums {
    public static int[][] generate(int maxSize, int maxNum) {
        int n1 = Math.abs((int) (Math.random() * maxSize - Math.random() * maxSize)) + 2;
        int n2 = Math.abs((int) (Math.random() * maxSize - Math.random() * maxSize)) + 2;
        int[][] res = new int[n1 + 1][n2 + 1];
        for (int i = 0; i < n1 + 1; i++) {
            for (int j = 0; j < n2 + 1; j++) {
                int temp = (int) (Math.random() * maxNum - Math.random() * maxNum);
                res[i][j] = temp;
            }
        }
        return res;
    }

    public static int[][] generatePos(int maxSize, int maxNum) {
        int n1 = (int) (Math.random() * maxSize) + 1;
        int n2 = (int) (Math.random() * maxSize) + 1;
        int[][] res = new int[n1][n2];
        for (int i = 0; i < n1; i++) {
            for (int j = 0; j < n2; j++) {
                res[i][j] = (int) (Math.random() * maxNum);
            }
        }
        return res;
    }

    public static int[][] generate01(int maxSize, int maxNum) {
        int n1 = Math.abs((int) (Math.random() * maxSize - Math.random() * maxSize)) + 1;
        int n2 = Math.abs((int) (Math.random() * maxSize - Math.random() * maxSize)) + 1;
        int[][] res = new int[n1][n2];
        for (int i = 0; i < n1; i++) {
            for (int j = 0; j < n2; j++) {
                int temp = (int) (Math.random() * maxNum);
                res[i][j] = temp;
            }
        }
        return res;
    }
}
